<div class="pz-block pz-block-gallery {$blockParams.css}">
    {if isset($parentFolder)}
    <h1>{$parentFolder->getLabel()}</h1>
	{assign var='modu' value=0}

	{if $blockParams.displayPag && isset($numPage) && $nbPageTot > 1}
		<div class="pz-block-pagination pz-block-pagination-top">
		{if $numPage > 1}<a href="{$uri}/{$numPage-1}" class="btn-prev">{t}Previous{/t}</a>{/if}
		{section name=foo start=1 loop=$nbPageTot+1}
			{assign var="i" value=$smarty.section.foo.iteration}
			<a href="{$uri}/{$i}" {if $numPage == $i}class="num-active"{/if}>{$i}</a>
		{/section}
		{if $numPage < $nbPageTot}<a href="{$uri}/{$numPage+1}" class="btn-next">{t}Next{/t}</a>{/if}
		</div>
		<div class="clear"></div>
	{/if}
	
	{if isset($folders)}
		<ul>
		{foreach from=$folders item=folder name=foo}
			{if $blockParams.nbLine != "auto" && $smarty.foreach.foo.iteration % $blockParams.nbLine == 0 }
				</ul>
				<div class="clear"></div>
				<ul>
			{/if}
			
			<li>
				<a href="{$folder.url}" title="{$folder.folder->getLabel()}">
				
			{if $blockParams.picWidth != "" && $blockParams.picHeight != ""}
				<img src="{$folder.media.media->getImageUrlByMaxSize($blockParams.picWidth, $blockParams.picHeight)}" alt="{$folder.folder->getLabel()}" title="{$folder.folder->getLabel()}" />
			{/if}
			<span class="media-folder">{$folder.folder->getLabel()} ({$folder.media.nb})</span>
			</a>
			</li>
			
			{if $blockParams.nbLine != "auto"}
				{assign var='modu' value=`$smarty.foreach.foo.iteration%$blockParams.nbLine`}
			{/if}
		{/foreach}
		</ul>
	{/if}
    
	{if isset($medias)}
		{assign var='mod' value=$modu}
		<ul>
		{foreach from=$medias item=media name=foo}
			{if $media.media->isImage()}
				
				{if $blockParams.nbLine != "auto" && $mod > 0 && $mod % $blockParams.nbLine == 0}
					</ul>
					<div class="clear"></div>
					<ul>
				{/if}
	        
				<li>
				{if $blockParams.details}
					<a href="{$media.url}" title="{$media.media->getTitle()}">
				{else}
					<div class="no-detail">
				{/if}
				
				{if $blockParams.picWidth != "" && $blockParams.picHeight != ""}
					<img src="{$media.media->getImageUrlByMaxSize($blockParams.picWidth, $blockParams.picHeight)}" alt="{$media.media->getAlt()}" title="{$media.media->getAlt()}" />
				{/if}
	            
				{if $blockParams.displayTitle}
					<span class="media-title">{$media.media->getTitle()}</span>
				{/if}
				
				{if $blockParams.displayName}
					<span class="media-label">{$media.media->getLabel()}</span>
				{/if}
				
				{if $blockParams.displayAuthor}
					<span class="media-author">{$media.media->getAuthor()}</span>
				{/if}
				
				{if $blockParams.displaySize}
					<span class="media-size">{$media.media->getSize()}</span>
				{/if}
				
				{if $blockParams.displayDim}
					<span class="media-dim">{$media.media->getWidth()} x {$media.media->getHeight()}</span>
				{/if}
				
				{if $blockParams.details}
					</a>
				{else}
					</div>
				{/if}
				</li>
        			{assign var='mod' value=$smarty.foreach.foo.iteration+$modu}
			{/if}
		{/foreach}
		</ul>
		<div class="clear"></div>
	{/if}

	{if !isset($folders) && !isset($medias)}
		<p>{t}There is no medias in this gallery.{/t}</p>
	{/if}
	<div class="clear"></div>

	{if $blockParams.displayPag && isset($numPage) && $nbPageTot > 1}
		<div class="pz-block-pagination pz-block-pagination-bottom">
		{if $numPage > 1}<a href="{$uri}/{$numPage-1}" class="btn-prev">{t}Previous{/t}</a>{/if}
		{section name=foo start=1 loop=$nbPageTot+1}
			{assign var="i" value=$smarty.section.foo.iteration}
			<a href="{$uri}/{$i}" {if $numPage == $i}class="num-active"{/if}>{$i}</a>
		{/section}
		{if $numPage < $nbPageTot}<a href="{$uri}/{$numPage+1}" class="btn-next">{t}Next{/t}</a>{/if}
		</div>
		<div class="clear"></div>
	{/if}
    
	{if isset($returnUrl)}
		<a href="{$returnUrl}" class="back-to-medias-list" >{t}Back{/t}</a>
	{/if}

    {else}
    <p>{t}There is no medias in the mediatheque.{/t}</p>
    {/if}
</div>
<div class="pz-block pz-block-socialShare">
	{socialShare}
	<div class="clear"></div>
</div>